import {dialog} from "electron";

// buttons: ['Cancel', 'OK']

export function dialogNone(title, message) {
    if (message) {
        dialog.showMessageBox({
            type: 'none',
            title: title,
            message: message,
        });
    } else {
        dialogNone2(title)
    }
}

function dialogNone2(message) {
    dialog.showMessageBox({
        type: 'none',
        title: '无标题',
        message: message,
    });
}

export function dialogInfo(title, message) {
    if (message) {
        dialog.showMessageBox({
            type: 'info',
            title: title,
            message: message,
        });
    } else {
        dialogInfo2(title)
    }
}

function dialogInfo2(message) {
    dialog.showMessageBox({
        type: 'info',
        title: "信息",
        message: message,
    });
}

export function dialogWarning(message) {
    dialog.showMessageBox({
        type: 'warning',
        title: "警告",
        message: message,
    });
}

export function dialogError(message) {
    dialog.showMessageBox({
        type: 'error',
        title: "异常",
        message: message,
    });
}
